Fix Multiple GNUton Mount Points#577
Conversation
Suggestion to Resolve Duplicate Mount-points
Update Version
Update Dates
Great catch by user
Nice sleuthing and great investigative work!!!
You've got the right idea for the solution, but there's no need for a new, dedicated blocking flock mechanism. We already have a readily available blocking lock implementation to do what's needed for this scenario. CORRECTION:
I'll merge this PR and then submit my changes in another PR. Essentially, the approach to the solution is correct, but it needs some improvements and fine-tuning. |
Issue reported by scootertramp on snbforums here: https://www.snbforums.com/threads/backupmon-v1-10-2-2026-may-24-backup-restore-your-router-jffs-nvram-external-usb-drive-encrypt-cifs-smb-nfs-available-in-amtm.93052/post-994663
The problem appears to be caused by multiple MerlinAU startup processes... such as "startup", "addCronJob", and "postUpdateEmail" running at the same time and reaching the GNUton webs_update.sh patch logic before being properly serialized. This created a race condition where processes shared temporary files, moved the same files, and sometimes stacked multiple bind mounts on /usr/sbin/webs_update.sh.
Below is an example of me recreating the problem using the following command:
sleep 5; /jffs/scripts/MerlinAU.sh startup & /jffs/scripts/MerlinAU.sh addCronJob & waitHere was the result of that command:
BEFORE:
TEST RUN:
AFTER:
The fix was to place entire initialization (log cleanup and the GNUton download/compare/mount sequence) behind a dedicated blocking flock, while also using PID-specific temporary filenames and checking operation return codes.
Since the issue can no longer be reproduced, the concurrency race appears resolved to me?
Any ideas or suggestions you have or would like to share?